<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      function timeout(ms) {
        return new Promise((resolve, reject) => {
          setTimeout(function () {
            console.log("定时器");
            resolve();
          }, ms);
        });
      }
      async function asyncPrint(ms, value) {
        //把具有异步操作的代码前面放入：await
        await timeout(ms);
        console.log(value);
      }
      asyncPrint(100, "hello");
    </script>
  </head>
  <body></body>
</html>
